use vudu
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		JUAN
-- este procedimiento consulta la lista de 
--prelaciones de por la materia de un pensum
-- =============================================
CREATE PROCEDURE sp_prelacion_materia 
	@nombre_materia varchar(50),
	@id_pensum      int 
AS
BEGIN
	SELECT m.nombreMateria 
	FROM materia m, PensumMateria pm 
	WHERE(pm.fk_id_pensum= @id_pensum ) and 
	(pm.fk_id_materia_prela = m.id_Materia) and 
	pm.fk_id_materia IN (SELECT m.id_Materia FROM materia m where  m.nombreMateria = @nombre_materia)
END
GO
